package week05.day03;

public class 二维数组的遍历 {
    public static void main(String[] args) {
        int[][] arr = {{1,2,3},{4,5,6},{7,8},{9}};
        for (int i=0;i<=arr.length-1;i++){//遍历子数组
            for (int j=0;j<=arr[i].length-1;j++){//对子数组中的元素进行遍历
                System.out.println(arr[i][j]);
            }
        }
        //使用foreach循环遍历数组
        for (int[]a:arr){
            for (int num:a){
                System.out.println(num);
            }
        }
    }
}
